#include "thread_pool.hpp"
#include "Task.hpp"
#include <time.h>
#include <unistd.h>

#define NUM 5

int main()
{
    srand((unsigned)time(nullptr));
    //ThreadPool<Task> *tp = new ThreadPool<Task>(NUM);
    //tp->InitThreadPool();

    //sleep(10);
    //cout<<1<<endl;
    thread_pool<Task> *tp = thread_pool<Task>::get_instance();
    tp->thread_pool_init(NUM);
    //cout<<2<<endl;
    sleep(3);

    const std::string ops = "+-*/%";
    while(true){
        int x = rand() % 50 + 1;
        int y = rand() % 50 + 1;
        char op = ops[rand()%5];
        //cout<<3<<endl;
        Task t(x, y, op);
       // cout<<4<<endl;
        tp->push_task(t);
       // cout<<5<<endl;
        sleep(1);
    }

    return 0;
}
